/* 响应式设计 CSS 工具类 */

/* 基础断点 */
@media (max-width: 480px) {
  .hidden-xs { display: none !important; }
  .visible-xs { display: block !important; }
}

@media (max-width: 576px) {
  .hidden-sm { display: none !important; }
  .visible-sm { display: block !important; }
}

@media (max-width: 768px) {
  .hidden-md { display: none !important; }
  .visible-md { display: block !important; }
}

@media (max-width: 992px) {
  .hidden-lg { display: none !important; }
  .visible-lg { display: block !important; }
}

@media (max-width: 1200px) {
  .hidden-xl { display: none !important; }
  .visible-xl { display: block !important; }
}

@media (max-width: 1600px) {
  .hidden-xxl { display: none !important; }
  .visible-xxl { display: block !important; }
}

/* 最小断点 */
@media (min-width: 480px) {
  .hidden-min-xs { display: none !important; }
  .visible-min-xs { display: block !important; }
}

@media (min-width: 576px) {
  .hidden-min-sm { display: none !important; }
  .visible-min-sm { display: block !important; }
}

@media (min-width: 768px) {
  .hidden-min-md { display: none !important; }
  .visible-min-md { display: block !important; }
}

@media (min-width: 992px) {
  .hidden-min-lg { display: none !important; }
  .visible-min-lg { display: block !important; }
}

@media (min-width: 1200px) {
  .hidden-min-xl { display: none !important; }
  .visible-min-xl { display: block !important; }
}

@media (min-width: 1600px) {
  .hidden-min-xxl { display: none !important; }
  .visible-min-xxl { display: block !important; }
}

/* Flex 布局响应式 */
@media (max-width: 576px) {
  .flex-col-sm { flex-direction: column !important; }
  .flex-row-sm { flex-direction: row !important; }
  .flex-wrap-sm { flex-wrap: wrap !important; }
  .flex-nowrap-sm { flex-wrap: nowrap !important; }
}

@media (max-width: 768px) {
  .flex-col-md { flex-direction: column !important; }
  .flex-row-md { flex-direction: row !important; }
  .flex-wrap-md { flex-wrap: wrap !important; }
  .flex-nowrap-md { flex-wrap: nowrap !important; }
}

@media (max-width: 992px) {
  .flex-col-lg { flex-direction: column !important; }
  .flex-row-lg { flex-direction: row !important; }
  .flex-wrap-lg { flex-wrap: wrap !important; }
  .flex-nowrap-lg { flex-wrap: nowrap !important; }
}

/* 文本对齐响应式 */
@media (max-width: 576px) {
  .text-left-sm { text-align: left !important; }
  .text-center-sm { text-align: center !important; }
  .text-right-sm { text-align: right !important; }
}

@media (max-width: 768px) {
  .text-left-md { text-align: left !important; }
  .text-center-md { text-align: center !important; }
  .text-right-md { text-align: right !important; }
}

@media (max-width: 992px) {
  .text-left-lg { text-align: left !important; }
  .text-center-lg { text-align: center !important; }
  .text-right-lg { text-align: right !important; }
}

/* 间距响应式 */
@media (max-width: 480px) {
  .p-xs-0 { padding: 0 !important; }
  .p-xs-1 { padding: 4px !important; }
  .p-xs-2 { padding: 8px !important; }
  .p-xs-3 { padding: 12px !important; }
  .p-xs-4 { padding: 16px !important; }
  .p-xs-5 { padding: 20px !important; }

  .m-xs-0 { margin: 0 !important; }
  .m-xs-1 { margin: 4px !important; }
  .m-xs-2 { margin: 8px !important; }
  .m-xs-3 { margin: 12px !important; }
  .m-xs-4 { margin: 16px !important; }
  .m-xs-5 { margin: 20px !important; }
}

@media (max-width: 576px) {
  .p-sm-0 { padding: 0 !important; }
  .p-sm-1 { padding: 4px !important; }
  .p-sm-2 { padding: 8px !important; }
  .p-sm-3 { padding: 12px !important; }
  .p-sm-4 { padding: 16px !important; }
  .p-sm-5 { padding: 20px !important; }

  .m-sm-0 { margin: 0 !important; }
  .m-sm-1 { margin: 4px !important; }
  .m-sm-2 { margin: 8px !important; }
  .m-sm-3 { margin: 12px !important; }
  .m-sm-4 { margin: 16px !important; }
  .m-sm-5 { margin: 20px !important; }
}

@media (max-width: 768px) {
  .p-md-0 { padding: 0 !important; }
  .p-md-1 { padding: 8px !important; }
  .p-md-2 { padding: 12px !important; }
  .p-md-3 { padding: 16px !important; }
  .p-md-4 { padding: 20px !important; }
  .p-md-5 { padding: 24px !important; }

  .m-md-0 { margin: 0 !important; }
  .m-md-1 { margin: 8px !important; }
  .m-md-2 { margin: 12px !important; }
  .m-md-3 { margin: 16px !important; }
  .m-md-4 { margin: 20px !important; }
  .m-md-5 { margin: 24px !important; }
}

/* 容器响应式 */
.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 576px) {
  .container {
    max-width: 540px;
    padding: 0 20px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
    padding: 0 24px;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 960px;
    padding: 0 28px;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
    padding: 0 32px;
  }
}

@media (min-width: 1600px) {
  .container {
    max-width: 1320px;
    padding: 0 40px;
  }
}

.container-fluid {
  width: 100%;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .container-fluid {
    padding: 0 24px;
  }
}

@media (min-width: 1200px) {
  .container-fluid {
    padding: 0 32px;
  }
}

/* 网格系统 */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -12px;
}

@media (max-width: 768px) {
  .row {
    margin: 0 -8px;
  }
}

.col {
  flex: 1;
  padding: 0 12px;
}

@media (max-width: 768px) {
  .col {
    padding: 0 8px;
  }
}

/* 列响应式 */
.col-xs-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-xs-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-xs-3 { flex: 0 0 25%; max-width: 25%; }
.col-xs-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-xs-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-xs-6 { flex: 0 0 50%; max-width: 50%; }
.col-xs-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-xs-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-xs-9 { flex: 0 0 75%; max-width: 75%; }
.col-xs-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-xs-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-xs-12 { flex: 0 0 100%; max-width: 100%; }

@media (min-width: 576px) {
  .col-sm-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  .col-sm-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  .col-sm-3 { flex: 0 0 25%; max-width: 25%; }
  .col-sm-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  .col-sm-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
  .col-sm-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  .col-sm-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  .col-sm-9 { flex: 0 0 75%; max-width: 75%; }
  .col-sm-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  .col-sm-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
}

@media (min-width: 768px) {
  .col-md-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  .col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  .col-md-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  .col-md-9 { flex: 0 0 75%; max-width: 75%; }
  .col-md-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  .col-md-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}

/* 表格响应式 */
@media (max-width: 768px) {
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive .el-table {
    min-width: 800px;
  }
}

@media (max-width: 480px) {
  .table-mobile {
    border: none;
  }

  .table-mobile thead {
    display: none;
  }

  .table-mobile tbody,
  .table-mobile tr,
  .table-mobile td {
    display: block;
    width: 100%;
    border: none;
  }

  .table-mobile tr {
    margin-bottom: 16px;
    border: 1px solid #e4e7ed;
    border-radius: 8px;
  }

  .table-mobile td {
    padding: 12px;
    border-bottom: 1px solid #f5f7fa;
    text-align: left;
    position: relative;
  }

  .table-mobile td:before {
    content: attr(data-label);
    position: absolute;
    left: 12px;
    font-weight: 600;
    color: #606266;
    width: 100px;
  }

  .table-mobile td {
    padding-left: 120px;
  }
}

/* 卡片响应式 */
@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (min-width: 769px) and (max-width: 1200px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
}

@media (min-width: 1201px) {
  .card-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
  }
}

/* 表单响应式 */
@media (max-width: 768px) {
  .form-horizontal .el-form-item {
    display: flex;
    flex-direction: column;
  }

  .form-horizontal .el-form-item__label {
    text-align: left;
    padding-bottom: 8px;
  }

  .form-horizontal .el-form-item__content {
    margin-left: 0 !important;
  }

  .el-form--inline {
    flex-direction: column;
    align-items: stretch;
  }

  .el-form--inline .el-form-item {
    margin-right: 0;
    margin-bottom: 16px;
    width: 100%;
  }
}

/* 导航响应式 */
@media (max-width: 768px) {
  .nav-horizontal {
    flex-direction: column;
  }

  .nav-horizontal .nav-item {
    width: 100%;
    border-bottom: 1px solid #e4e7ed;
  }

  .nav-collapsible {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
  }

  .nav-collapsible.active {
    display: block;
  }

  .nav-toggle {
    display: block;
  }
}

@media (min-width: 769px) {
  .nav-toggle {
    display: none;
  }

  .nav-collapsible {
    display: flex !important;
    position: static;
    box-shadow: none;
  }
}

/* 侧边栏响应式 */
@media (max-width: 768px) {
  .sidebar-collapsible {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    transition: left 0.3s ease;
  }

  .sidebar-collapsible.active {
    left: 0;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0 !important;
  }
}

@media (min-width: 769px) {
  .sidebar-overlay {
    display: none !important;
  }
}

/* 分页响应式 */
@media (max-width: 480px) {
  .el-pagination {
    justify-content: center;
    flex-wrap: wrap;
  }

  .el-pagination .el-pagination__sizes,
  .el-pagination .el-pagination__jump {
    display: none;
  }

  .el-pagination .btn-prev,
  .el-pagination .btn-next {
    min-width: 32px;
    height: 32px;
  }
}

@media (max-width: 768px) {
  .el-pagination .el-pagination__sizes {
    display: none;
  }
}

/* 对话框响应式 */
@media (max-width: 768px) {
  .el-dialog {
    width: 90% !important;
    margin: 10vh auto !important;
  }

  .el-dialog__header {
    padding: 16px 20px;
  }

  .el-dialog__body {
    padding: 20px;
  }

  .el-dialog__footer {
    padding: 16px 20px;
    text-align: center;
  }

  .el-dialog__footer .el-button {
    width: 100%;
    margin: 0 4px;
  }
}

@media (max-width: 480px) {
  .el-dialog {
    width: 95% !important;
    margin: 5vh auto !important;
  }
}

/* 抽屉响应式 */
@media (max-width: 768px) {
  .el-drawer {
    width: 100% !important;
  }
}

/* 消息提示响应式 */
@media (max-width: 480px) {
  .el-message {
    min-width: 300px;
  }

  .el-notification {
    width: 90%;
    right: 5%;
  }
}

/* 工具类 */
.mobile-only { display: none; }
.tablet-only { display: none; }
.desktop-only { display: block; }

@media (max-width: 768px) {
  .mobile-only { display: block; }
  .tablet-only { display: none; }
  .desktop-only { display: none; }
}

@media (min-width: 769px) and (max-width: 1200px) {
  .mobile-only { display: none; }
  .tablet-only { display: block; }
  .desktop-only { display: none; }
}

/* 打印样式 */
@media print {
  .no-print { display: none !important; }
  .print-only { display: block !important; }

  .el-pagination,
  .el-button,
  .el-input,
  .el-select,
  .el-drawer,
  .el-dialog {
    display: none !important;
  }
}